<template>
    <div class="banner">
        <van-swipe class="my-swipe" :autoplay="3000" indicator-color="white">
            <van-swipe-item v-for="item in bannerList" :key="item.name">
                <img :src="item.image" />
            </van-swipe-item>
        </van-swipe>
    </div>
</template>

<script>
import banner from '@/api/banner'

export default {
    data() {
        return {
            bannerList: [],
        }
    },
    created() {
        this.getBanner()
    },
    methods: {
        getBanner() {
            banner.getBanner()
                .then(res => {

                    if (res.code == 200) {
                        this.bannerList = res.bannerList
                    } else {
                        this.$notify({ type: 'danger', message: res.message });

                    }
                })
        }
    }
}
</script>

<style scoped>
.banner {
    margin: 20px 0;
}

.banner img {
    width: 100%;
}
</style>